<template>
    <div>
        <cu-navbar>
            <block slot="content">动态</block>
        </cu-navbar>
        <view class="qiye-dongtai-page page">
            <div class="f-r a-c input-box">
                <u-search shape="square" :showAction="false" bgColor="#f8f8f8" v-model="searchValue" placeholder="请输入搜索内容" inputAlign="left" height="70rpx"></u-search>
            </div>
            <div class="list-box">
                <div class="list-item f-r" v-for="(item,index) in list" :key="index" @click="toDetail(item)">
                    <image :src="item.url" style="width:120px;height: 80px;margin-right: 10px;"></image>
                    <div class="f-c">
                        <div class="name">{{ item.title }}</div>
                    </div>
                </div>
            </div>
        </view>
    </div>
</template>

<script>
	export default {
		data() {
			return {
				searchValue: '',
				list: []
			}
		},
		onLoad() {
			// 杜康动态
			this.$api.home(0).then(res => {
				this.list = res.result.painters.map(el => {
					return {
						title: el.title,
						url: el.pic,
						...el
					}
				})
			})
		},
		methods: {
			toDetail(row) {
				uni.navigateTo({
					url: '/pages/qiye-dongtai/content?id=' + row.id
				})
			}
		}
	}
</script>

<style lang="scss">
.qiye-dongtai-page {
	.input-box {
		background-color: #fff;
		    padding: 20px;
	}
	.list-box {
		margin-top: 10px;
		 padding: 20px;
		 background-color: #fff;
		 padding: 0 20px;
		 .list-item {
			 border-bottom: 1px solid #eee;
			 padding: 20px 0;
			 .name {
				     font-size: 15px;
				     font-weight: 400;
				     overflow: hidden;
				     color: #333;
				     text-overflow: ellipsis;
				     margin: 10px 0 7px 0;
			 }
		 }
	}
}
</style>
